<head>
  <style>
      table, th, td {
          border: 1px solid black;
          border-collapse: collapse;
      }
      th,td {
          padding: 15px;
          text-align: center;
      }
  </style>
</head>
<div>
  <%= link_to 'Back to Home', {:controller => 'hiring_specialist', :action => 'home'} %>
  <h1 align="center">Phone Interview</h1>
</div>

<% if( @questions.length > 0) %>
    <div>
      <table style="width:100%"; bgcolor="#F6F6FF">
        <tr>
          <th> <u>Applicant Name</u>: <%= @personalInfo['first'] %> <%= @personalInfo['middle'] %>. <%= @personalInfo['last'] %></th>
          <th> <u>Phone Number</u>: <%= @personalInfo['phone'] %></th>
          <th> <u>Position (Store Location)</u>: <%= @applyPosition[0]['title'] %> (<%= @applyPosition[0]['city'] %>, <%= @applyPosition[0]['state'] %>)</th>
        </tr>
      </table>
    </div>

    <% $numQuestion = 1 %>
    <div>
      <%= form_tag(controller: 'hiring_specialist', action: 'app_submit', method: 'get') do %>
          <%= hidden_field_tag 'app_id', @appId %>
          <% @questions.each do |question| %>
              <br /><br />
              Question #<%= $numQuestion %>: <%= question['text'] %>

              <%if (question['type'] == 'multiple_choice') %>
                  <% question['answers'].each do |answer| %>
                      <br />
                      <%= radio_button_tag(question['position_question_id'], answer['question_option_id']) %> <%= answer['text'] %>
                      <%if( answer['correct'] == '1' )%>
                          [Correct Answer]
                      <% end %>
                  <% end %>
              <% else %>
                  <br />
                  <%= text_area_tag(question['position_question_id'], nil, {rows: 5, cols: 60}) %>
              <% end %>

              <% $numQuestion += 1%>
          <% end %>

          <br /><br />
          <b>Additional Notes:</b>
          <br />
          <%= text_area_tag('notes', nil, {rows: 5, cols: 60}) %>
          <br /><br />
          <%= submit_tag('Deny') %> <%= submit_tag('Approve') %>
      <% end %>
    </div>
<% else %>
    <br /><br /><h2>No Questions to display</h2>
<% end %>
